package com.lingnan.mapper;

import com.lingnan.pojo.Collect;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * <p>
 * 收藏表 Mapper 接口
 * </p>
 *
 * @author 梁兴达
 * @since 2022-03-06
 */
@Repository
public interface CollectMapper extends BaseMapper<Collect> {

    @Select("select * from tb_collect where active_id = #{id} and no = #{no} and useful = 1 ;")
    Collect selectByIdAndNo(@Param("id") Integer id, @Param("no") String no);

    @Update("update tb_collect set useful = 0 where active_id = #{id} and no = #{no};")
    boolean updateCollect(@Param("id") Integer id,@Param("no") String no);
}
